package top.superflow.version.db.jpa

import javax.persistence.Index
import org.apache.commons.lang3.StringUtils
import top.superflow.verify.Ensure
import top.superflow.version.db.IndexVersion

class JpaIndexVersion (originalIndex : Any) extends IndexVersion with Ensure{
  
  notNull(originalIndex)
  
  originalIndex match {
    case ann : Index =>{
      this.name.compareAndSet(this.name.get, ann.name())
      this.columnList ++= StringUtils.split(ann.columnList(),",")
      this.unique.compareAndSet(this.unique.get, ann.unique())
    }
  }
  
}